package src;

import java.util.Objects;
public class Student {

    private final String studentId; // 学号，设为final，一旦创建不可更改
    private String name;          // 姓名
    private int age;              // 年龄

    public Student(String studentId, String name, int age) {
        this.studentId = studentId;
        this.name = name;
        this.age = age;
    }

    public String getStudentId() {
        return studentId;
    }

    public String getName() {
        // YOUR CODE HERE
        return name;
    }

    public void setName(String name) {
        this.name=name;
        // YOUR CODE HERE
    }

    public int getAge() {
        // YOUR CODE HERE
        return age;
    }

    public void setAge(int age) {
        this.age=age;
        // YOUR CODE HERE
    }



    @Override
    public String toString() {
        // YOUR CODE HERE
        return "学号："+studentId+",姓名："+name+",年龄："+age;
    }

    @Override
    public boolean equals(Object o) {
        if(this==o)return true;
        if(o==null||getClass()!=o.getClass())return false;
        Student student=(Student)o;
        return Objects.equals(studentId,student.studentId);
    }

    @Override
    public int hashCode() {

        return Objects.hash(studentId);
    }
}



